<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<a href="order/or?rtid=1&date=2018-08-10%20-%202018-08-13">立即预定</a>
	<input type="button" value="立即预定" onclick="addCart()">
	<input type="button" value="立即预定2" onclick="addCart2()">
	
	<script src="../js/jquery.min.js" charset="utf-8"></script>
		<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
		
		<script type="text/javascript">
		function addCart(){
			$.ajax({
				url:"/cart/cart",
				type:"post",
				data:{
					id:1,
					img:"img/011.jpg",
					type:"大床房",
					rtid:1,
					price:180,
					number:1,
					date:"2018-08-10 - 2018-08-14"
				},
				success:function(data){
					alert(data);
				}
			});
		}
		
		function addCart2(){
			$.ajax({
				url:"/cart/cart",
				type:"post",
				data:{
					id:2,
					img:"img/012.jpg",
					type:"豪华单间",
					rtid:3,
					price:260,
					number:1,
					date:"2018-08-10 - 2018-08-14"
				},
				success:function(data){
					alert(data);
				}
			});
		}
		</script>
<script type="text/javascript" src="js/jquery-2.1.4.js"></script>
<script type="text/javascript">
</script>
</head>
</html>